import { IRouteComponentProps, SettingModelState, useDispatch, useSelector } from "umi";
import Comment from '@/components/Comment';
import styles from './index.less';

const PageDetail: React.FC<IRouteComponentProps<{id: string}>> = ({match})=>{
  const id = match.params.id;
  const dispatch = useDispatch();
  const {pageSetting,} = useSelector((state: { setting: SettingModelState }) =>state.setting);
  const detail = pageSetting.find(item=>item.path === id);

  if (!detail) {
    return null;
  }
  return <div className={styles.container}>
    <div dangerouslySetInnerHTML={{__html: detail!.content}}></div>
    {/* 评论模块 */}
    <Comment id={detail.id}/>
    {/* 推荐阅读模块 */}
  </div>
}

export default PageDetail;
